# Table B.2: Maximum Likelihood Estimation of Tau and Gamma


# 1. Load Packages ----

library(stargazer)

# 2. Read in Data ----

load(file = "df_voxit_individual_allrefs.RData")

# 3. Regressions ----
# With Covariates
glm.out_fx <- glm(formula = turnout ~ offset(1*salience) + difficulty + male + 
                    married + age + uni + knowledge + leftright, 
                  data = voxit_complete_salience[voxit_complete_salience$prop_voxit==1,],
                  family = binomial(link = "logit")) 
summary(glm.out_fx)

# Without Covariates
glm.out_f <- glm(formula = turnout ~ offset(1*salience) + difficulty, 
                 data = voxit_complete_salience[voxit_complete_salience$prop_voxit==1,],
                 family = binomial(link = "logit")) 
summary(glm.out_f)


# 4. Regression Table
stargazer(glm.out_f, glm.out_fx,
          type = "latex", star.cutoffs = c(0.1, 0.05, 0.01),
          star.char = c("*", "**", "***"), summary=T,
          covariate.labels = c("$\\tau$", "Male", "Married", "Age", "University", 
                               "Political knowledge", "Left-Right"), df = F,
          dep.var.caption="Dependent variable: Turnout",
          dep.var.labels.include=F, float = F, 
          omit.table.layout ="n",
          keep.stat = c("n"),
          out = "TableB2.tex")
